<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<%@ include file="../../common/jsp/sheetHeader.jsp" %>
<script>
	$(document).ready(function() {
		//sheet 초기화  
		var cfg = {
		    Chart : {
				Animation : true,
		        PlotBackgroundColor : "#FAFAFA",
				PlotBorderColor:"#A9AEB1",
		        PlotBorderWidth:0.5,
				BackgroundColor:{
					LinearGradient : [0,0,100,500],
					Stops : [
						[0, "#D7E1F3"],
						[1, "#FFFFFF"]
					]
				},
				BorderColor : "#84888B",
				
				Type : "column",
		        Style : {
		            FontSize : "20px"
		        }		
		    },
			Credits : {
				Enabled:false
			},
			
			Colors : ["#7AAAEE","#F06F3E","#AAEE6A","#F0E150","#5DA0A9","#75738B"],
			
		    Legend : {
				Enabled:false
		    },
			
		    YAxis : {
		        LineColor : "#7F7F7F",
		        TickInterval : 50,
				GridLineDashStyle : "solid",
		        GridLineWidth : 1,
		        GridLineColor : "#C4C9CD",
		        LineWidth : 1,
		        Title : {
		            Text : ""
		        }
		    }
		}
		
		myChart.SetOptions(cfg);
		myChart.Draw();
		myChart.DoSearch("../data/chartdata.xml");
		
		myChartDraw();
		
	});
	
	function myChartDraw() {
		var Type = $("#barCombo").val();
// 		myChart.RemoveAll();
		
		switch(Type){
			case "BAR":
				myChart.SetBaseOptions({
					Type:"bar"
				},1);
				
				myChart.SetPlotOptions({
					Series:{
						Stacking:"",
						DataLabels:{
							Enabled : true,
							Align : "center",
							Color : "#333333"
						}
					}
				},1);
				break;
	
			case "BAR_Stacking_Normal":
				myChart.SetBaseOptions({
					Type:"bar"
				},1);
				
				myChart.SetPlotOptions({
					Series:{
						Stacking:"normal",
						DataLabels:{
							Enabled : true,
							Align : "center",
							Color : "#FFFFFF"
						}
					}
				},1);
				break;
	
			case "BAR_Stacking":
				myChart.SetBaseOptions({
						Type:"bar"
					},1);
					
					myChart.SetPlotOptions({
						Series:{
							Stacking:"percent",
							DataLabels:{
								Enabled : true,
								Align : "center",
								Color : "#FFFFFF"
							}
						}
					},1);
				break;
	
			case "COLUMN":
				myChart.SetBaseOptions({
						Type:"column"
					},1);
					
					myChart.SetPlotOptions({
						Series:{
							Stacking:"",
							DataLabels:{
								Enabled : true,
								Align : "center",
								Color : "#333333"
							}
						}
					},1);
				break;
	
			case "COLUMN_Stacking_Normal":
				myChart.SetBaseOptions({
						Type:"column"
					},1);
					
					myChart.SetPlotOptions({
						Series:{
							Stacking:"normal",
							DataLabels:{
								Enabled : true,
								Align : "center",
								Color : "#ffffff"
							}
						}
					},1);
				break;
	
			case "COLUMN_Stacking":
				myChart.SetBaseOptions({
						Type:"column"
					},1);
					
					myChart.SetPlotOptions({
						Series:{
							Stacking:"percent",
							DataLabels:{
								Enabled : true,
								Align : "center",
								Color : "#ffffff"
							}
						}
					},1);
				break;
		}
		
		//myChart.RemoveAll() 을 했을 경우,
// 		myChart.DoSearch("../data/chartdata.xml");
		myChart.Draw();
	}
	
</script>
<title>막대 차트 예제</title>
</head>
<body>
<div id="main">
	<%@ include file="../../common/jsp/chartNavi.jsp" %>	
	<div id="title">막대 차트 예제</div>
	<div id="desc">
		주의 사항<br>
		jquery.min.js 파일은 반드시 ibchart.js 보다 앞에 링크걸도록 한다.<br>
		&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;<br>
		&lt;script type="text/javascript" src="/Chart/ibchart.js">&lt;/script&gt;<br>
		&lt;script type="text/javascript" src="/Chart/ibchartinfo.js">&lt;/script&gt;<br>
		<br>
		막대(Bar, Column)형태의 차트
	</div>

	<div id="functionArea">
	<select class="chartCombo" id="barCombo" onchange="myChartDraw()">
		<option value="BAR">바</option> 
		<option value="BAR_Stacking_Normal">누적 바</option> 
		<option value="BAR_Stacking">100% 누적 바</option> 
		<option value="COLUMN" selected>막대</option> 
		<option value="COLUMN_Stacking_Normal">누적 막대</option> 
		<option value="COLUMN_Stacking">100% 누적 막대</option> 
	</select>
	</div>
	
	<div id="viewArea">
		<script type="text/javascript">
			createIBChart("myChart", "1000px", "300px");
		</script>
	</div>
</div>
</body>
</html>